import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const TOKEN_KEY = 'HAOKE'
export default new Vuex.Store({
state: {
// 一个对象，存储登录信息token数据
user: JSON.parse(window.localStorage.getItem(TOKEN_KEY))
},
getters: {},
mutations: {
setUser (state, data) {
state.user = data
window.localStorage.setItem(TOKEN_KEY, JSON.stringify(state.user))
}
},
actions: {}
})